package cn.edu.xidian.domain;

import android.os.Parcel;
import android.os.Parcelable;


public class User implements Parcelable{

    private String user_id;
    private String user_website;
    private String user_name;
    private String user_pwd;

    public User() {
    }

    public User(String user_id, String user_website, String user_name, String user_pwd) {
        this.user_id = user_id;
        this.user_website = user_website;
        this.user_name = user_name;
        this.user_pwd = user_pwd;
    }

    public String getUser_id() {
        return user_id;
    }

    public void setUser_id(String user_id) {
        this.user_id = user_id;
    }

    public String getUser_website() {
        return user_website;
    }

    public void setUser_website(String user_website) {
        this.user_website = user_website;
    }

    public String getUser_name() {
        return user_name;
    }

    public void setUser_name(String user_name) {
        this.user_name = user_name;
    }

    public String getUser_pwd() {
        return user_pwd;
    }

    public void setUser_pwd(String user_pwd) {
        this.user_pwd = user_pwd;
    }

    @Override
    public String toString() {
        return "User{" +
                "user_id='" + user_id + '\'' +
                ", user_website='" + user_website + '\'' +
                ", user_name='" + user_name + '\'' +
                ", user_pwd='" + user_pwd + '\'' +
                '}';
    }

    /**
     * 实现Parcel接口
     * @return
     */
    protected User(Parcel in) {
        user_id = in.readString();
        user_website = in.readString();
        user_name = in.readString();
        user_pwd = in.readString();
    }

    /**
     * 反序列化
     */
    public static final Creator<User> CREATOR = new Creator<User>() {

        /**
         * 从序列化对象中获取对象
         * @param in
         * @return
         */
        @Override
        public User createFromParcel(Parcel in) {
            return new User(in);
        }

        /**
         * 创建指定长度的原始对象数组
         * @param size
         * @return
         */
        @Override
        public User[] newArray(int size) {
            return new User[size];
        }
    };

    @Override
    public int describeContents() {
        return this.hashCode();
    }

    /**
     * 往parcel中写数据
     * @param dest
     * @param flags
     */
    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(user_id);
        dest.writeString(user_website);
        dest.writeString(user_name);
        dest.writeString(user_pwd);
    }
}
